@abstractframework/code 0.4.2 → 0.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +23 -7
- package/bin/cli.js +24 -19
- package/bin/server.js +169 -596
- package/dist/assets/index-0dumrfuU.css +1 -0
- package/dist/assets/index-Bh7omXp3.js +59 -0
- package/dist/index.html +2 -2
- package/dist/sw.js +4 -3
- package/package.json +8 -5
- package/dist/assets/index-BbWQ0HEw.js +0 -56
- package/dist/assets/index-D3pBYdPy.css +0 -1
package/README.md
CHANGED
|
@@ -13,6 +13,15 @@ Run it without installing anything:
|
|
|
13
13
|
npx @abstractframework/code # serves on http://127.0.0.1:3002
|
|
14
14
|
```
|
|
15
15
|
|
|
16
|
+
The server listens on `127.0.0.1` by default; pass `--host 0.0.0.0` to accept
|
|
17
|
+
other machines directly (it then prints a warning that it is exposed beyond
|
|
18
|
+
this machine). AbstractGateway (0.7.0 or later) can also start it
|
|
19
|
+
and serve it at `/apps/code/` on the gateway's own address, which is the one
|
|
20
|
+
address to expose or tunnel for a remote machine. Launch flags:
|
|
21
|
+
`--gateway-url <url>`, `--port <n>`, `--host <addr>`, `--help`; without
|
|
22
|
+
`--gateway-url` the server uses the gateway installed on this computer
|
|
23
|
+
(`~/.abstractframework/gateway.json`), else `http://127.0.0.1:8080`.
|
|
24
|
+
|
|
16
25
|
The interface uses AbstractUIC themes, authentication, settings, and reusable
|
|
17
26
|
workflow chat. It builds without a sibling checkout: the shared
|
|
18
27
|
`@abstractframework/*` components install from npm like any other dependency,
|
|
@@ -32,7 +41,7 @@ npm run dev
|
|
|
32
41
|
|
|
33
42
|
In the UI:
|
|
34
43
|
- set `Gateway URL` (e.g. `http://127.0.0.1:8080`), or configure it on the
|
|
35
|
-
server with `
|
|
44
|
+
server with `--gateway-url` (the packaged server; `npm start -- --gateway-url …`)
|
|
36
45
|
- set `Gateway user` and that user's `Gateway token`
|
|
37
46
|
|
|
38
47
|
When a Gateway user is provided, the web server exchanges the token for a
|
|
@@ -40,15 +49,22 @@ Gateway browser session and stores only app-scoped session cookies. The raw
|
|
|
40
49
|
token is not persisted in browser settings. Vite development and the packaged
|
|
41
50
|
server use the same session proxy; the browser keeps API requests same-origin.
|
|
42
51
|
|
|
43
|
-
Choose
|
|
44
|
-
|
|
52
|
+
Choose a workflow in the toolbar: **Gateway default** (the coding agent your
|
|
53
|
+
gateway's operator set, resolved by the gateway when the turn starts), a
|
|
54
|
+
published coding agent, or, with **Show all workflows**, any registered
|
|
55
|
+
workflow. The **Files** tab shows the conversation's workspace on the gateway
|
|
56
|
+
with previews, **Settings → Stream replies** shows replies as the model writes
|
|
57
|
+
them (on gateways that support it), and **About** lists the app's and the
|
|
58
|
+
gateway's versions. Agent tasks use the composer; structured workflows use
|
|
59
|
+
**Inputs**. Questions, tool approvals, and
|
|
45
60
|
event waits appear in the conversation. Runs and history remain on the gateway
|
|
46
61
|
when you close the browser. Unsent drafts and queued turns do not survive reload.
|
|
47
62
|
|
|
48
|
-
Whether a browser may change the Gateway URL is decided by the
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
63
|
+
Whether a browser may change the Gateway URL is decided by the browser's
|
|
64
|
+
address: only a browser on this machine may reconfigure it (forwarded headers
|
|
65
|
+
count only from a loopback peer such as the gateway's `/apps/code/` relay),
|
|
66
|
+
and a sign-in over a loopback connection must name a loopback host. The
|
|
67
|
+
server-configured Gateway URL is authoritative for everyone else. Set `ABSTRACTCODE_ALLOW_REMOTE_BROWSER_GATEWAY_CONFIG=1` to allow
|
|
52
68
|
it from anywhere, behind your own access control. Behind a reverse proxy every
|
|
53
69
|
peer is the proxy, so loopback carries no meaning there — set
|
|
54
70
|
`ABSTRACTCODE_TRUST_PROXY_HEADERS=1` to refuse browser-supplied changes
|
package/bin/cli.js
CHANGED
|
@@ -1,30 +1,35 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
3
|
+
import { createGatewayUrlResolver, parseAppFlagsOrExit } from "@abstractframework/app-server";
|
|
4
|
+
|
|
5
|
+
import { bindExposureWarning, createCodeServer } from "./server.js";
|
|
6
|
+
|
|
7
|
+
// The shared launch flags: --gateway-url (aliases --gateway, --url), --port,
|
|
8
|
+
// --host (default 127.0.0.1: the gateway serves this app at /apps/code/),
|
|
9
|
+
// --help. Environment variables are legacy aliases only (PORT, HOST,
|
|
10
|
+
// ABSTRACTCODE_GATEWAY_URL, ABSTRACTGATEWAY_URL).
|
|
11
|
+
const flags = parseAppFlagsOrExit(process.argv.slice(2), {
|
|
12
|
+
appName: "AbstractCode Web",
|
|
13
|
+
command: "abstractcode-web",
|
|
14
|
+
envPrefix: "ABSTRACTCODE",
|
|
15
|
+
defaultPort: 3002,
|
|
16
|
+
});
|
|
14
17
|
|
|
15
|
-
|
|
16
|
-
|
|
18
|
+
// A flag or environment choice is fixed; otherwise the local gateway pointer
|
|
19
|
+
// is followed (re-read when the gateway refuses a connection, so a running
|
|
20
|
+
// app follows the gateway onto a new port).
|
|
21
|
+
const fixed = flags.gatewayUrlSource === "flag" || flags.gatewayUrlSource.startsWith("env:");
|
|
22
|
+
const server = createCodeServer({ defaultGatewayUrl: fixed ? flags.gatewayUrl : createGatewayUrlResolver() });
|
|
17
23
|
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
24
|
+
// Said before listening, so it shows even when the bind then fails.
|
|
25
|
+
const exposure = bindExposureWarning(flags.host, flags.port);
|
|
26
|
+
if (exposure) console.warn(exposure);
|
|
21
27
|
|
|
22
|
-
|
|
23
|
-
`);
|
|
28
|
+
server.listen(flags.port, flags.host, () => {
|
|
29
|
+
console.log(`AbstractCode Web on http://${flags.host}:${flags.port}/ (gateway ${flags.gatewayUrl}, from ${flags.gatewayUrlSource})`);
|
|
24
30
|
});
|
|
25
31
|
|
|
26
32
|
function shutdown() {
|
|
27
|
-
console.log("\n\n👋 Shutting down AbstractCode Web...\n");
|
|
28
33
|
server.close(() => process.exit(0));
|
|
29
34
|
}
|
|
30
35
|
|